Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for enjoi and tape packages, change dev dependencies. #97

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

dlobregon
Copy link

No description provided.

/* eslint-disable global-require */
/* eslint-disable no-use-before-define */
/* eslint-disable prefer-const */
/* eslint-disable max-len */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are those exceptions really needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm agree with you, the changes have been done.

utils.verbs.forEach((verb) => {
let route; let pathnames; let operation; let
validators;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like some of these variables can be const, and also can you use a line per declaration?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if one of them need to be let, can you declare it previous to first assignation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I applied your suggestion using const and let.


route.handler && routes.push(route);
let api; let routes; let handlers; let defaulthandler; let
validator;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you verify if is it possible to use const for these variables?

package.json Outdated
@@ -17,24 +17,28 @@
},
"bugs": "http://github.com/krakenjs/swaggerize-builder/issues",
"engines": {
"node": "<=4.x"
"node": ">=10"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be >=12?
latest version of Joi requires node 12

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the change is done.

lib/validator.js Outdated
fragment = typeof fragment === 'object' && fragment[paths[i]];
}
// eslint-disable-next-line no-plusplus
for (let i = 1; i < paths.length && fragment; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (let i = 1; i < paths.length && fragment; i++) {
for (let i = 1; i < paths.length && fragment; i+=1) {

We could use the i += 1 expression or we could add the "allowForLoopAfterthoughts": true rule to the eslint config file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, the change is done.

Copy link

@RobertTheBlair RobertTheBlair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves issue 94 - please update that issue, bring it to the creator's attention

@@ -1,3 +1,9 @@
### 1.0.12

- Update to node v10, add `package-lock.json` file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be v12?

Might also want to make a bigger version jump if we are ruling out old node versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on Node 12. Maybe it can be changed to node 10+.
Curious, is package-lock.json for unit tests? Shouldn't unit tests always run on the latest dependency versions?

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "swaggerize-routes",
"version": "1.0.11",
"version": "1.0.12",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is node 12 minimum a point release?

@grawk
Copy link
Member

grawk commented Mar 16, 2021

@dlobregon I've published 2.0.0-alpha.1 and pushed a branch 2.0.0-alpha back to this repo to keep track of what is published as alpha.

@@ -435,7 +429,7 @@ test('named validation', function (t) {
t.plan(numErrorDetails + 1);
t.ok(error, 'error.');
error.details.forEach(function (detail) {
t.ok(detail.path === parameterName, 'Expected error.details.path to equal ' + parameterName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was it failing earlier? what changed?

@kumarrishav
Copy link
Member

looks good to me.

@maxmil7
Copy link

maxmil7 commented Aug 16, 2021

👍

- "4"
- "6"
- "8"
- "12"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add 14


if (thing.isString(dir)) {
assert.ok(fs.existsSync(dir), 'Specified or default \'handlers\' directory does not exist.');
let handlers; let

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why not let handlers, obj;?

@@ -1,3 +1,9 @@
### 1.0.12

- Update to node v10, add `package-lock.json` file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on Node 12. Maybe it can be changed to node 10+.
Curious, is package-lock.json for unit tests? Shouldn't unit tests always run on the latest dependency versions?

makeAll: function (validators, route) {
var self = this;
makeAll(validators, route) {
const self = this;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is not needed now, as we are using arrow function.

detail.path = [parameter.name];
});
utils.debuglog('%s', result.error.message);
return callback(result.error);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is using callback, should we avoid potentially returning a value in validate function?
i.e. change this to
callback(result.error); return;

return callback(result.error);
}

return callback(null, result.value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is using callback, should we avoid potentially returning a value in validate function?
i.e. change this to
callback(null, result.value);

@@ -149,130 +140,134 @@ module.exports = function validator(options) {
* @returns {*}
*/
function refresolver(schemas, value) {
var id, refschema, path, fragment, paths;
let id; let refschema; let path; let fragment; let

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This IMO is weird from readability. Should we instead define all as one let or define them in separate lines?

@sumeetkakkar
Copy link

Few minor comments. Otherwise looks good for semver major.

@ESRogs
Copy link

ESRogs commented Sep 26, 2021

Is anyone able to merge this? Would be nice to get a resolution to: #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants